---
layout: "default"
title: "Operator: &*="
description: "Swift documentation for the '&*=' operator."
root: "/v4.2"
---

<code class="language-swift"> operator &amp;*= {
    associativity right
    precedence 
    assignment
}</code>

<h3>Declarations</h3>

<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
<div class="declaration inherited" id="func-ampstareq_-inout-self-rhs_-self">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampstareq_-inout-self-rhs_-self">func &amp;*=(<wbr>_:<wbr> inout Self, rhs: Self)</a>
        
<div class="comment collapse" id="comment-func-ampstareq_-inout-self-rhs_-self"><div class="p">
    <p>Multiplies two values and stores the result in the left-hand-side
variable, discarding any overflow.</p>

<p>The masking multiplication assignment operator (<code>&amp;*=</code>) silently discards 
any overflow that occurs during the operation. In the following example, 
the product of <code>10</code> and <code>50</code> is greater than the maximum representable 
<code>Int8</code> value, so the result is the overflowed value:</p>

<pre><code class="language-swift">var x: Int8 = 10
x &amp;*= 5
// x == 50
var y: Int8 = 10
y &amp;*= 50
// y == -12 (after overflow)</code></pre>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> The first value to multiply.
  <strong>rhs:</strong> The second value to multiply.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func &amp;*=(lhs: inout Self, rhs: Self)</code>
    
        <h4>Declared In</h4>
        <a href="../../protocol/FixedWidthInteger/"><code>FixedWidthInteger</code></a>    
</div></div>
</div>
